
define(["js/mCard.js","js/mCommon.js","js/mVideo.js","js/mPage.js"],function(card,common,video,page){  
	return {
		
		/*
		 * 排行榜
		 * */
		richList:function(){
			
			
		},
		
		/*道具*/
		propsList:function(h,d){
			var _t = this;
			var html = "<div class='props-content'>"+
							"<span id='props-header' class='props-header'><span class='props_icon props_"+d.token+"'></span></span>"+
							"<div class='props-text'>"+
								"<h1 id='props-name'>"+d.itemName+"</h1>"+
								"<p id='props-description'>"+d.itemDescription+"</p>"+
								"<div class='props-button'><span token='"+d.token+"'  class='pokeyButton pokeyButton-2 button-blue-2 icon' id='props-use'><span class='text-sy num_icon'></span></span></div>"+
							"</div>"+
							"<div id='propsTimer' class='propsTimer'></div>"+
						"</div>"+
						"<div class='props-logo'>"+
							"<span id='props-left' class='icon props-scroll'></span>"+
							"<span  class='propsPicScroll'>"+
								"<div class='propsRecommend'><ul class='items' id='propsLists'>"+h+"</ul>"+
								"</div>"+
							"</span>"+
							"<span id='props-right'  class='icon props-scroll box_right'></span>"+
						"</div>";
			
			$("body").box({
				id:"props",
				width:550,
				height:250,
				headerHtml:"",
				buttonHtml:"",
				contentHtml:html,
				bindEvent:function(c){
					var list = $("#propsLists .item");
					var use = $("#props-use");
					
					list.click(function(){
			    		
			    		$(this).addClass("itemOn").siblings().removeClass("itemOn");
			    		
			    		var token = $(this).attr("token");
			    		var name = $(this).attr("name");
			    		var description = $(this).attr("description");
			    		use.attr("token",token);
			    		$("#props-name").html(name);
			    		$("#props-description").html(description);
			    		$("#props-header").html("<span class='props_icon props_"+token+"'></span>");
			    	});
					
					
					use.click(function(){
			    		$(this).removeClass("on-120");
			    		var token = use.attr("token");
			    		requestUseItem(token);
			    		c();
			    	});
					
					
					setTimeout(function(){
						player.countdown("props", c,18);
						$('.propsRecommend').sliderImg({
							pageWith:118,
							cycle: false,
							leftMove:"#props-left",
							rightMove:"#props-right",
							onchange:function(t,n,settings){
							}
						});
					},500);
				}
			});
		},
		
		/*比赛*/
		game:function(){
			$("body").box({
				id:"box_game",
				width:600,
				headerHtml:"比赛房",
				buttonHtml:"<span  class='pokeyButton button-blue play_icon' id='props-no'>关 闭</span>",
				contentHtml:$("#matchGame").html(),
				bindEvent:function(c){
					var props_use = $("#props-no");
					props_use.click(function(){
			    		c();
					});
				}
			});
			
			$(".room_game_list").live("click",function(){
				var roomId =  $(this).attr("room");
				enterRoom(roomId);
			})
		},
		
		
		/*菜单*/
		menu:function(){
			$("body").box({
				id:"box-menu",
				width:400,
				height:100,
				hasClose:false,
				headerHtml:"",
				buttonHtml:"<input name='' type='button' value='确 定'  class='pokeyButton button-blue' id='props-yes'/><input name='' type='button' value='取 消'  class='pokeyButton button-blue' id='props-no'/>",
				contentHtml:"<div class='box-text'>确认要退出游戏吗？</div>",
				bindEvent:function(c){
					
					var yes = $("#props-yes"),no = $("#props-no");
					
					yes.click(function(){
			    		c();
			    		forceOut(dataStorage.get(MyOwner.playerId));
			    		location.reload();
					});
					
					no.click(function(){
			    		c();
					});
					
				}
			});
		},
		
		
		/*道具已使用*/
		useProps:function(text){
			$("body").box({
				id:"box-useProps",
				width:400,
				height:100,
				hasClose:false,
				headerHtml:"",
				buttonHtml:"<span  class='pokeyButton pokeyButton-2 button-blue-2 icon' id='props-yes'><span class='text-ok num_icon'></span></span>",
				contentHtml:"<div class='box-text' style='text-align:center'>"+text+"</div>",
				bindEvent:function(c){
					
					var yes = $("#props-yes");
					yes.click(function(){
			    		c();
					});
				}
			});
		},
		
		
		/*解锁*/
		lock:function(score){
			var html = "<div class='box-text'>解锁需要：" +
							"<ul class='box-lock' >" +
								"<li >" +
									"<span class='icon_dou icon'></span><span id='box-score' class='tangNum'></span>" +
								"</li>" +
							"</ul>" +
						"</div>";
			
			$("body").box({
				id:"box-lock",
				width:400,
				headerHtml:"",
				hasClose:false,
				buttonHtml:"<span  class='pokeyButton pokeyButton-2 button-blue-2 icon' id='props-yes'><span class='text-ok num_icon'></span></span><span  class='pokeyButton pokeyButton-2 button-yellow-2 icon' id='props-no'><span class='text-no num_icon'></span></span>",
				contentHtml:html,
				bindEvent:function(c){
					console.log("score:"+score);
					$("#box-score").html(card.getNumGif(score,"blue"));
				
					var yes = $("#props-yes"),no = $("#props-no");
					
					yes.click(function(){
			    		c();
			    		page.unlockBoss();
					});
				
					no.click(function(){
			    		c();
					});
				}
			});
		},
		
		
		/*设置*/
		set:function(){
			var html = "<div class='box-text'>" +
							"<ul class='box-set' >" +
								"<li >" +
									"<span class='box-set-text'>背景音乐：</span><span id='set_bg_on' class='box-set-list'><span class='icon_on room_icon'></span>on</span><span id='set_bg_off' class='box-set-list'><span class='icon_off room_icon'></span>off</span>" +
								"</li>" +
								"<li >" +
									"<span class='box-set-text'>背景音效：</span><span id='set_yx_on' class='box-set-list'><span class='icon_on room_icon'></span>on</span><span id='set_yx_off' class='box-set-list'><span class='icon_off room_icon'></span>off</span>" +
								"</li>" +
							"</ul>" +
						"</div>";
			
			$("body").box({
				id:"box-set",
				width:400,
				headerHtml:"",
				buttonHtml:"<span  class='pokeyButton pokeyButton-2 button-blue-2 icon' id='props-yes'><span class='text-ok num_icon'></span></span>",
				contentHtml:html,
				bindEvent:function(c){
					var yes = $("#props-yes");
					yes.click(function(){
			    		c();
					});
				}
			});
			
			var bgOn = $("#set_bg_on"),
			bgOff = $("#set_bg_off"),
			yxOn = $("#set_yx_on"),
			yxOff = $("#set_yx_off");
			
			bgOn.live(common.getEvent[0],function(){
				bgOn.find(".room_icon").addClass("on-120");
	    	});
			bgOn.live(common.getEvent[1],function(){
				bgOn.find(".room_icon").removeClass("on-120");
	    		bgOn.find(".room_icon").removeClass("icon_off").addClass("icon_on");
	    		bgOff.find(".room_icon").removeClass("icon_on").addClass("icon_off");
	    		video.playBg();
	    	});
			
			bgOff.live(common.getEvent[0],function(){
				bgOff.find(".room_icon").addClass("on-120");
	    	});
			bgOff.live(common.getEvent[1],function(){
				bgOff.find(".room_icon").removeClass("on-120");
	    		bgOn.find(".room_icon").removeClass("icon_on").addClass("icon_off");
	    		bgOff.find(".room_icon").removeClass("icon_off").addClass("icon_on");
	    		video.stopBg();
	    	});
			
			yxOn.live(common.getEvent[0],function(){
				yxOn.find(".room_icon").addClass("on-120");
	    	});
			yxOn.live(common.getEvent[1],function(){
				yxOn.find(".room_icon").removeClass("on-120");
	    		yxOn.find(".room_icon").removeClass("icon_off").addClass("icon_on");
	    		yxOff.find(".room_icon").removeClass("icon_on").addClass("icon_off");
	    		video.pokeyAudio();
	    	});
			
			
			yxOff.live(common.getEvent[0],function(){
				yxOff.find(".room_icon").addClass("on-120");
	    	});
			yxOff.live(common.getEvent[1],function(){
				yxOff.find(".room_icon").removeClass("on-120");
	    		yxOn.find(".room_icon").removeClass("icon_on").addClass("icon_off");
	    		yxOff.find(".room_icon").removeClass("icon_off").addClass("icon_on");
	    		video.stopPokeyAudio();
	    	});
			
		},
		
		
		/*比赛详情*/
		gameDetailed:function(){
			var html = "<div class='box-text'>" +
							"<div style='text-align:center'><span class='num_icon text-bsxq2'></span></div>"+
							"<p>规则：淘汰赛，地主赢6分，农民赢3分，输得0分，地主输-6分，农民输-3分，中午12点开始，晚上22点结束，一天总共11场，正点半小时开一场，时间结束则结束，满21个人开赛，打满6盘结算，若有同分者再加多一盘，积分最高者排第一。</p>"+
						"</div>";
			
			$("body").box({
				id:"box-set",
				width:400,
				headerHtml:"",
				buttonHtml:"",
				contentHtml:html,
				bindEvent:function(c){
					
				}
			});
		},
		
		
		/*查看奖励*/
		lookAwards:function(n){
			var text = card.getAwards(n)
			var html = "<div class='box-text'>" +
							"<div style='text-align:center'><span class='num_icon text-ckjl2'></span></div>"+
							"<p  style='text-align:center'>"+text+"</p>"+
						"</div>";
			
			$("body").box({
				id:"box-set",
				width:400,
				headerHtml:"",
				buttonHtml:"",
				contentHtml:html,
				bindEvent:function(c){
					
				}
			});
		},
		
		
		/*当前排行*/
		currentRanking:function(h){
			var html = "<div >"+h+"</div>";
			
			$("body").box({
				id:"box-set",
				width:400,
				headerHtml:"",
				buttonHtml:"",
				contentHtml:html,
				bindEvent:function(c){
					
				}
			});
		},
		
		/*救济金*/
		alms:function(n,almsNum){
			if(almsNum == 0){
				return;
			}else{
				if(n===2){
					var html = "<div class='box-text'>领取今天第一次救助金1000金币</div> ";
				}else if(n===1){
					var html = "<div class='box-text'>领取今天第二次救助金1000金币</div> ";
				}else if(n===0){
					var html = "<div class='box-text'>这是您今天最后一次领取救助金，需要更多的金币请充值！</div>";
				}
			}
			
			
			
			
			
			$("body").box({
				id:"box-buy",
				width:500,
				headerHtml:"",
				hasClose:false,
				buttonHtml:"<span  class='pokeyButton pokeyButton-2 button-blue-2 icon' id='alms-yes'><span class='text-ok num_icon'></span></span><span  class='pokeyButton pokeyButton-2 button-blue-2 icon' id='alms-alms'><span class='text-gm num_icon'></span></span>",
				contentHtml:html,
				bindEvent:function(c){
					var yes = $("#alms-yes");
					var cz = $("#alms-alms");
					yes.click(function(){
						c();
					});
					
					//充值
					var forTime=(new Date()).getTime();
					cz.click(function(){
						location.href = Game.getBaseURL() + "/mall.jsp?"+forTime;
					})
				}
			});
			
		},
		
		/*去PKBOSS*/
		toBoss:function(text){
			var html = "<div class='box-text'>"+text+"</div>";
			$("body").box({
				id:"box-toBoss",
				width:400,
				headerHtml:"",
				buttonHtml:"",
				contentHtml:html,
				bindEvent:function(c){
				}
			});
		},
		
		/*去比赛场*/
		toCompetition:function(text){
			var html = "<div class='box-text'>"+text+"</div>";
			$("body").box({
				id:"box-toCompetition",
				width:400,
				headerHtml:"",
				buttonHtml:"",
				contentHtml:html,
				bindEvent:function(c){
				}
			});
		},
		
		/*去乐豆场*/
		toBeanfun:function(text){
			var html = "<div class='box-text'>"+text+"</div>";
			$("body").box({
				id:"box-toBeanfun",
				width:400,
				headerHtml:"",
				buttonHtml:"",
				contentHtml:html,
				bindEvent:function(c){
				}
			});
		},
		
		
		/*不能开启BOSS*/
		noGoBoss:function(){
			var html = "<div class='box-text'>要达到3500金币，才能开启boss房</div>";
			$("body").box({
				id:"box-noGoBoss",
				width:400,
				headerHtml:"",
				buttonHtml:"",
				contentHtml:html,
				bindEvent:function(c){
				}
			});
		},
		
		/*不能开启比赛场*/
		noGoCompetition:function(){
			var html = "<div class='box-text'>要达到20000金币，才能开启比赛场</div>";
			$("body").box({
				id:"box-noGoCompetition",
				width:400,
				headerHtml:"",
				buttonHtml:"",
				contentHtml:html,
				bindEvent:function(c){
					
				}
			});
		},
		
		/*不能开启乐豆*/
		noGoBeanfun:function(){
			var html = "<div class='box-text'>要达到18000金币，才能开启乐斗场</div>";
			$("body").box({
				id:"box-noGoBeanfun",
				width:400,
				headerHtml:"",
				buttonHtml:"",
				contentHtml:html,
				bindEvent:function(c){
				}
			});
		},
		
		/*乐豆规则*/
		beanfunRule:function(){
			var html = "<div class='box-text'>乐斗是可以使用道具，底分100的房间，各位可以进入商城去购买道具来进行打牌，赚取星星，糖果和金币，同时每5盘会有神秘的转盘抽奖等着您哦！快来尝尝一夜暴富的快感吧！</div>";
			$("body").box({
				id:"box-noGoBeanfun",
				width:400,
				headerHtml:"",
				buttonHtml:"",
				contentHtml:html,
				bindEvent:function(c){
				}
			});
		},
		
		/*比赛结算*/
		gameReslute:function(text){
			var html = "<div class='box-text'>"+text+"</div>";
			$("body").box({
				id:"box-toBeanfun",
				width:400,
				headerHtml:"",
				hasClose:false,
				buttonHtml:"<span  class='pokeyButton pokeyButton-2 button-blue-2 icon' id='game-yes'><span class='text-ok num_icon'></span></span>",
				contentHtml:html,
				bindEvent:function(c){
					var yes = $("#game-yes");
					yes.click(function(){
						c();
					});
				}
			});
		},
		
		
		
	}
}); 